<div id='panel'>

<div class="fulldiv" style="width:700px;">

 <div class="fulldiv" style="margin:10px 0px 0px 0px;">
 	<div style="float: left; margin: 0 10px; padding-top: 8px;"><strong class="orangehead">Your Classified Posts</strong></div>
	<div class="greyarrowsml" onclick="show_hide_s_boxes('classifieds1')" id="arrow_classifieds1">&nbsp;</div>
	
	<div class="fulldiv" style="width:49%; margin-top:13px; float:right;">
	<div class="star" style="float: right;" id="star_classifieds1">&nbsp;</div>
	<a href="javascript:void(0)" class="bluelink" style="float: right;" <?php if($_SESSION['user_type_sess']==1) { ?>onclick="show_more_classified_info_buyer()"<?php } else { ?>onclick="show_more_classified_info()"<?php } ?> id="more_info_sell_u_p">more info</a>
	</div>
 </div>
<script language="javascript" type="text/javascript">
function show_more_classified_info()
{
  var ntop = ( $(window).height() - $('#more_classified_info').height() ) / 2+$(window).scrollTop();
  var nleft = ( $(window).width() - $('#more_classified_info').width() ) / 2+$(window).scrollLeft();

  $('#more_classified_info').css({'left': nleft, 'top':ntop});
  $('#more_classified_info').fadeIn('slow');
}

function show_more_classified_info_buyer()
{
  var ntop = ( $(window).height() - $('#more_classified_info_buyer').height() ) / 2+$(window).scrollTop();
  var nleft = ( $(window).width() - $('#more_classified_info_buyer').width() ) / 2+$(window).scrollLeft();

  $('#more_classified_info_buyer').css({'left': nleft, 'top':ntop});
  $('#more_classified_info_buyer').fadeIn('slow');
}

</script>

<div id="classifieds1">
<div class="fullbox_top">&nbsp;</div>
<div class="fullbox_repeat" >

<?php 
//print_r($_SESSION[]);
$userId=$_SESSION['user_id_sess'];
$sqlQuery="SELECT * FROM tbl_post,tbl_category as cat where subcategory_id=cat.category_id AND posted_by='$userId' and parent_id='2' order by post_id desc";
$resultSetJob=mysql_query($sqlQuery);
$sqlQuery="SELECT * FROM tbl_post,tbl_category as cat where subcategory_id=cat.category_id AND posted_by='$userId' and parent_id='5' order by post_id desc";
$resultSetService=mysql_query($sqlQuery);
$sqlQuery="SELECT * FROM tbl_post,tbl_category as cat where subcategory_id=cat.category_id AND posted_by='$userId' and parent_id='3' order by post_id desc";
$resultSetRent=mysql_query($sqlQuery);
$sqlQuery="SELECT * FROM tbl_post,tbl_category as cat where subcategory_id=cat.category_id AND posted_by='$userId' and parent_id='4' order by post_id desc";
$resultSetReal=mysql_query($sqlQuery);

$cnt=mysql_num_rows($resultSetJob)+mysql_num_rows($resultSetReal)+mysql_num_rows($resultSetService)+mysql_num_rows($resultSetRent);
//$cnt=0;
function convertTime($difference)
{

      //Calculate how many days are within $difference

      $days = intval($difference / 86400);

      //Keep the remainder

      $difference = $difference % 86400;

      //Calculate how many hours are within $difference

      $hours = intval($difference / 3600);

      //Keep the remainder

      $difference = $difference % 3600;

      //Calculate how many minutes are within $difference

      $minutes = intval($difference / 60);

      //Keep the remainder

      $difference = $difference % 60;

      //Calculate how many seconds are within $difference

      $seconds = intval($difference);

      //Output:

      return "Days:".$days." Hours:". $hours ." Minutes:". $minutes ." Seconds:". $seconds;

}
  
  if(isset($_REQUEST['post_id']))
  {
	$curtime=date("Y-m-d h:i:s");
	$rs=mysql_query("update tbl_post set post_duration='30',posted_date='".$curtime."' where post_id='".$_REQUEST['post_id']."'");
  }
?>
<table width="98%" border="0" cellpadding="2" cellspacing="2">
<?php

if($cnt!=0) { 
	while($data=@mysql_fetch_object($resultSetJob))
	{
		$y=date('Y',strtotime($data->posted_date));
		$d=date('d',strtotime($data->posted_date));
		$m=date('m',strtotime($data->posted_date));
		$h=date('h',strtotime($data->posted_date));
		$i=date('i',strtotime($data->posted_date));
		$s=date('s',strtotime($data->posted_date));
		
		$futureTime = mktime(date($h), date($i), date($s), date($m), date($d)+ $data->post_duration, date($y));
		
		//Get current Unix time stamp
		//echo "<br>";
		$currentTime = time();
		
		//Calculate the difference in seconds
		if($futureTime > $currentTime)
		{
			$difference = $futureTime - $currentTime;
			$d=date('Y-m-d h:i:s',$futureTime);
			$remainder = getRemainingTime($d);
			//echo $remainder;
		}
		else
		{
			$remainder=0;
		}
		
		?>
        <tr>
          
		<td valign="top">
			<table width="100%" border="0">
				<tr>
					<td colspan="2"><a href="index.php?showPost=<?php echo $data->post_id; ?>"><?php echo $data->post_company; ?> </a></td>
					<td width="18%"><strong>Location</strong></td>
					<td width="38%"><?php echo $data->post_location; ?></td>
				</tr>
				<tr>
					<td width="25%"><strong>Salary</strong>:</td>
					<td width="19%">$<?php echo $data->price; ?></td>
					<td><strong>Job Title:</strong></td>
					<td><?php echo $data->post_name; ?></td>
				</tr>
				<tr>
					<td><strong>Education Level </strong>:</td>
					<td><?php echo $data->education;     ?></td>
					<td><strong>Post Date</strong>:</td>
					<td><?php echo date("m-d-Y G:i:s A",strtotime($data->posted_date)) ?> </td>
				</tr>
			</table>
		</td>
                <td>
			<a href="index.php?editjob=2&postid=<?php echo $data->post_id; ?>">Edit</a><br /><a href="#">Delete</a>
			&nbsp;
			<?
				
			if($remainder=='0')
			{
		      ?>
			   <a href="index.php?mySwapen&post_id=<?php echo $data->post_id; ?>" class="yellow_btn" style="text-decoration:none; float:none; padding:10px 5px 10px 5px; height:24px;">Re-post</a>
		      <?
			}
			else
			{
		      ?>
			  <strong>Time Left :</strong> <?=$remainder?>
		      <?	
			}
			 $remainder="";
		      ?>  
		</td>
        </tr>
          
        <tr>
		<td colspan="2" height="10"></td>
        </tr>
        <tr>
		<td colspan="2" height="1" bgcolor="#999999"></td>
	</tr> 
        <?php
	}
		
		while($data=@mysql_fetch_object($resultSetRent)){
			
			 $y=date('Y',strtotime($data->posted_date));
			 $d=date('d',strtotime($data->posted_date));
			 $m=date('m',strtotime($data->posted_date));
			 $h=date('h',strtotime($data->posted_date));
			 $i=date('i',strtotime($data->posted_date));
			 $s=date('s',strtotime($data->posted_date));
			
			 $futureTime = mktime(date($h), date($i), date($s), date($m), date($d)+ $data->post_duration, date($y));
			
			//Get current Unix time stamp
                       //echo "<br>";
			 $currentTime = time();
			
			//Calculate the difference in seconds
			if($futureTime > $currentTime)
			{
				$difference = $futureTime - $currentTime;
				$d=date('Y-m-d h:i:s',$futureTime);
				$remainder = getRemainingTime($d);
			}
			else
			{
				$remainder=0;
			}
			
			?>
          <tr>
            
            <td valign="top">
            <table width="100%" border="0">
            <tr>
                  <td colspan="2"><a href="index.php?showPost=<?php echo $data->post_id; ?>"><?php echo $data->post_name; ?></a></td>
                  <td width="13%"><strong>Location</strong></td>
                  <td width="40%"><?php echo $data->post_location; ?></td>
                </tr>
                <tr>
                  <td width="22%"><strong>Price</strong>:$<?php echo $data->price; ?></td>
                  <td width="25%">&nbsp;</td>
                  <td><strong>Property</strong>:</td>
                  <td><?php echo $data->category_name; ?></td>
                </tr>
                <tr>
                  <td><strong>Bedroom</strong>	:<?php echo $data->bedroom;   ?><strong> <br />Bathroom</strong>:<?php echo $data->bathroom;  ?></td>
                  <td><strong>SQ FT</strong>	:<?php echo $data->post_sqrt; ?> </td>
                  <td><strong>Post Date</strong>:</td>
                  <td><?php echo date("m-d-Y G:i:s A",strtotime($data->posted_date)) ?> </td>
                </tr>
              </table>            </td>
                            <td><a href="index.php?editjob=3&postid=<?php echo $data->post_id; ?>">Edit</a> | <a href="#">Message</a>
			    &nbsp;
				<?
				
				  if($remainder=='0')
				  {
				?>
				     <a href="index.php?mySwapen&post_id=<?php echo $data->post_id; ?>" class="yellow_btn" style="text-decoration:none; float:none; padding:10px 5px 10px 5px; height:24px;">Re-post</a>
				<?
				  }
				  else
				  {
				?>
				    <strong>Time Left :</strong> <?=$remainder?>
				<?	
				  }
				   $remainder="";
				?>
			    </td>
          </tr>
          
          <tr>
            <td colspan="2" height="10"></td>
            </tr>
             <tr>
            <td colspan="2" height="1" bgcolor="#999999"></td>
    </tr> 
        <?php }?>    
        <?php 
		
		while($data=@mysql_fetch_object($resultSetReal)){
			 $y=date('Y',strtotime($data->posted_date));
			 $d=date('d',strtotime($data->posted_date));
			 $m=date('m',strtotime($data->posted_date));
			 $h=date('h',strtotime($data->posted_date));
			 $i=date('i',strtotime($data->posted_date));
			 $s=date('s',strtotime($data->posted_date));
			
			 $futureTime = mktime(date($h), date($i), date($s), date($m), date($d)+ $data->post_duration, date($y));
			
			//Get current Unix time stamp
                       //echo "<br>";
			 $currentTime = time();
			
			//Calculate the difference in seconds
			if($futureTime > $currentTime)
			{
				$difference = $futureTime - $currentTime;
				$d=date('Y-m-d h:i:s',$futureTime);
				$remainder = getRemainingTime($d);
			}
			else
			{
				$remainder=0;
			}
		?>
          <tr>
            
            <td valign="top"><table width="100%" border="0">
            <tr>
                  <td colspan="2"> <a href="index.php?showPost=<?php echo $data->post_id; ?>"><?php echo $data->post_name; ?></a></td>
                  <td width="13%"><strong>Location</strong></td>
                  <td width="40%"><?php echo $data->post_location; ?></td>
                </tr>
                <tr>
                  <td width="22%"><strong>Price</strong>:$<?php echo $data->price;     ?></td>
                  <td width="25%">&nbsp;</td>
                  <td><strong>Property</strong>:</td>
                  <td><?php echo $data->category_name; ?></td>
                </tr>
                <tr>
                  <td><strong>Bedroom</strong>	:<?php echo $data->bedroom;   ?><strong> <br />Bathroom</strong>:<?php echo $data->bathroom;  ?></td>
                  <td><strong>SQ FT</strong>	:<?php echo $data->post_sqrt; ?> </td>
                  <td><strong>Post Date</strong>:</td>
                  <td><?php echo date("m-d-Y G:i:s A",strtotime($data->posted_date)) ?> </td>
                </tr>
            </table>                              </td>
                            <td><a href="index.php?editjob=4&postid=<?php echo $data->post_id; ?>">Edit</a> | <a href="#">Message</a>
			    &nbsp;
				<?
				
				  if($remainder=='0')
				  {
				?>
				     <a href="index.php?mySwapen&post_id=<?php echo $data->post_id; ?>" class="yellow_btn" style="text-decoration:none; float:none; padding:10px 5px 10px 5px; height:24px;">Re-post</a>
				<?
				  }
				  else
				  {
				?>
				    <strong>Time Left :</strong> <?=$remainder?>
				<?	
				  }
				   $remainder="";
				?>
			    </td>
          </tr>
          
          <tr>
            <td colspan="2" height="10"></td>
    </tr>
     <tr>
            <td colspan="2" height="1" bgcolor="#999999"></td>
    </tr> 
        <?php }?>    
        <?php 
		
		
		while($data=@mysql_fetch_object($resultSetService)){
			
			 $y=date('Y',strtotime($data->posted_date));
			 $d=date('d',strtotime($data->posted_date));
			 $m=date('m',strtotime($data->posted_date));
			 $h=date('h',strtotime($data->posted_date));
			 $i=date('i',strtotime($data->posted_date));
			 $s=date('s',strtotime($data->posted_date));
			
			 $futureTime = mktime(date($h), date($i), date($s), date($m), date($d)+ $data->post_duration, date($y));
			
			//Get current Unix time stamp
                       //echo "<br>";
			 $currentTime = time();
			
			//Calculate the difference in seconds
			if($futureTime > $currentTime)
			{
				$difference = $futureTime - $currentTime;
				echo $d=date('Y-m-d h:i:s',$futureTime);
				$remainder = getRemainingTime($d);
			}
			else
			{
				$remainder=0;
			}
		 ?>
          <tr>
            
            <td valign="top">
            <table width="100%" border="0">
            <tr>
                  <td colspan="2"><a href="index.php?showPost=<?php echo $data->post_id; ?>"><?php echo $data->post_name; ?></a></td>
                  <td width="18%"><strong>Location</strong></td>
                  <td width="40%"><?php echo $data->post_location; ?></td>
                </tr>
                <tr>
                  <td width="11%"><strong>Price</strong>	:</td>
                  <td width="31%">$<?php echo $data->price;?></td>
                  <td><strong>Post Date</strong>:</td>
                  <td><?php echo date("m-d-Y G:i:s A",strtotime($data->posted_date)) ?></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp; </td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
              </table>           </td>
                            <td><a href="index.php?editjob=5&postid=<?php echo $data->post_id;?>">Edit</a> | <a href="#">Message</a>
			     &nbsp;
				<?
				
				  if($remainder=='0')
				  {
				?>
				     <a href="index.php?mySwapen&post_id=<?php echo $data->post_id; ?>" class="yellow_btn" style="text-decoration:none; float:none; padding:10px 5px 10px 5px; height:24px;">Re-post</a>
				<?
				  }
				  else
				  {
				?>
				    <strong>Time Left :</strong> <?=$remainder?>
				<?	
				  }
				   $remainder="";
				?>
			    </td>
          </tr>
          
          <tr>
            <td colspan="2" height="10"></td>
            </tr>
             <tr>
            <td colspan="2" height="1" bgcolor="#999999"></td>
    </tr> 
        <?php } ?>
       
		
		<?php 
		} else {
		?>       
        <tr>
		<td colspan="2" height="30" align="center">
			<div class="box" style="float:none;">
				<div class="box_top">&nbsp;</div>
				<div class="box_middle">
				    <div class="boxtxt_out"><strong>Make a Classified Add</strong></div>
				    <div class="boxtxt_out"><em>Post a job, rental, real estate or service needed or provided today</em></div>
					<div class="boxtxt_out">
						<div class="box_img">
							<img src="images/starthere_blue.png" style="cursor:pointer;" onclick="window.location='index.php?post'" />
						</div>
					</div>
				</div>
				<div class="box_bottom">&nbsp;</div>
			</div>
		</td>
	</tr>
         <?php } ?>  
		 
		  
        </table>
		<?php
		if($cnt!=0) {
		?>
		<table width="98%" border="0" cellpadding="2" cellspacing="2">
			<tr>
				<td>
					<div class="fulldiv">
						<input class="yellow_btn" type="button" value="Create more posts" style="margin:10px auto 0px auto; float:none;" onclick="window.location.href='index.php?post'" />
					</div>
				</td>
			</tr>
		</table>
		<?php
		}
		?>

</div>

<div style=" display: none; width: 400px; font-weight:bold; padding:10px; background-color:#cccccc; opacity:0.9;" class="user_popup" id="more_classified_info">
  <span style="float:left; width:100%; text-align:right; margin-bottom:5px;"><label style="cursor:pointer;" onclick="$('#more_classified_info').fadeOut('slow');">x</label></span>
  <span style="float:left; width:100%; margin-bottom:10px;" id="desc_info2">Classifieds are completely free for you to post: Jobs, Real Estate Property, Rent property, and services. Tip: if the post has expired you don't have to re-create a new post, just click on the re-post, and you'll have your ad up in seconds for up to 30 days.</span>
</div>

<div style=" display: none; width: 400px; font-weight:bold; padding:10px; background-color:#cccccc; opacity:0.9;" class="user_popup" id="more_classified_info_buyer">
  <span style="float:left; width:100%; text-align:right; margin-bottom:5px;"><label style="cursor:pointer;" onclick="$('#more_classified_info_buyer').fadeOut('slow');">x</label></span>
  <span style="float:left; width:100%; margin-bottom:10px;" id="desc_info2">Classifieds are completely free for you to post: Jobs, Real Estate Property, Rent property, and services for seller. Tip: if the post has expired you don't have to re-create a new post, just click on the repost and you'll have your ad up in seconds.</span>
</div>


<div class="fullbox_bot">&nbsp;</div>
</div>
<hr style="float:left; width:500px; display:none;" id="hr_line_classifieds1" />
</div>

</div>
<br />